import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { UserDto } from 'src/app/models/sys/user.dto';
import { BehaviorSubject } from 'rxjs';
import { ApiService } from 'src/app/services/api.service';

@Component({
  selector: 'app-employee-detail',
  templateUrl: './employee-detail.component.html',
  styleUrl: './employee-detail.component.less'
})
export class EmployeeDetailComponent implements OnInit {
  @Input() userSubject = new BehaviorSubject<UserDto>(new UserDto());
  @Output() detailEvent = new EventEmitter<boolean>();

  user?: UserDto;

  constructor(private _api: ApiService) {

  }

  ngOnInit(): void {
    this.userSubject.subscribe((value) => {
      this.user = value;
    });
  }

  onClose(event: UIEvent) {
    event.preventDefault();

    this.detailEvent.emit(true);
  }
}
